<?php 
	require_once("includes/constants.php");
	require_once("includes/common.php");
	require_once("includes/template.php");
		
	$view=false;
	$update=false;
	$add=false;
	 if (isset($_REQUEST['operation'])) { //modify garment
	 	if ($_REQUEST['operation'] == "view") {
	 		$view = true;
			head("View Garment Details");
	 	}
		else if ($_REQUEST['operation'] == "update") {
			$update = true;
			head("Update Garment Details");
		}
		else if ($_REQUEST['operation'] == "add") {		
			$add=true;
			head("Add New Garment");
		}
	 }

?>

<table cellspacing="5px"  width="100%">

<tr>
		<td align="right">
			<label for="g_name">Garment Name</label>			
		</td>
		<td>
			<input  maxlength="30" id="g_name" name="g_name" type="text" 
			value="<?php if ($update || $view) echo $_SESSION[GARMENTS][$_REQUEST['selectedGarment']]['g_name']; ?>"
			<?php if ($update || $view) echo 'readonly'; ?>  />			
		</td>
	</tr>

<tr>
		<td align="right">
			<label for="g_style">Style</label>			
		</td>
		<td>
			<input  maxlength="50" id="g_style" name="g_style" type="text" 
			value="<?php if ($update || $view) echo $_SESSION[GARMENTS][$_REQUEST['selectedGarment']]['g_style']; ?>"
			<?php if ($update || $view) echo 'readonly'; ?>  />			
		</td>
	</tr>

<tr>
		<td align="right">
			<label for="g_department">Department</label>			
		</td>
		<td>
			<input  maxlength="50" id="g_department" name="g_department" type="text" 
			value="<?php if ($update || $view) echo $_SESSION[GARMENTS][$_REQUEST['selectedGarment']]['g_department']; ?>"
			<?php if ($update || $view) echo 'readonly'; ?>  />			
		</td>
	</tr>

<tr>
		<td align="right">
			<label for="g_description">Description</label>			
		</td>
		<td>
			<input  maxlength="50" id="g_description" name="g_description" type="text" 
			value="<?php if ($update || $view) echo $_SESSION[GARMENTS][$_REQUEST['selectedGarment']]['g_description']; ?>"
			<?php if ($update || $view) echo 'readonly'; ?>  />			
		</td>
	</tr>

<tr>
		<td align="right">
			<label for="g_image_thumbnail">Image Thumb URL</label>			
		</td>
		<td>
			<input  maxlength="100" id="g_image_thumbnail" name="g_image_thumbnail" type="text" 
			value="<?php if ($update || $view) echo $_SESSION[GARMENTS][$_REQUEST['selectedGarment']]['g_image_thumbnail']; ?>"
			<?php if ($update || $view) echo 'readonly'; ?>  />			
		</td>
	</tr>

<tr>
		<td align="right">
			<label for="g_image_closeup">Image Close Up URL</label>			
		</td>
		<td>
			<input  maxlength="100" id="g_image_closeup" name="g_image_closeup" type="text" 
			value="<?php if ($update || $view) echo $_SESSION[GARMENTS][$_REQUEST['selectedGarment']]['g_image_closeup']; ?>"
			<?php if ($update || $view) echo 'readonly'; ?>  />			
		</td>
	</tr>

<tr>
		<td align="right">
			<label for="g_keywords">Keywords</label>			
		</td>
		<td>
			<input  maxlength="50" id="g_keywords" name="g_keywords" type="text" 
			value="<?php if ($update || $view) echo $_SESSION[GARMENTS][$_REQUEST['selectedGarment']]['g_keywords']; ?>"
			<?php if ($update || $view) echo 'readonly'; ?>  />			
		</td>
	</tr>

<tr>
		<td align="right">
			<label for="g_price">Price</label>			
		</td>
		<td>
			<input  maxlength="20" id="g_price" name="g_price" type="text" 
			value="<?php if ($update || $view) echo $_SESSION[GARMENTS][$_REQUEST['selectedGarment']]['g_price']; ?>"
			<?php if ($update || $view) echo 'readonly'; ?>  />			
		</td>
	</tr>

<tr>
		<td align="right">
			<label for="g_hours_to_make">Hours To Make</label>			
		</td>
		<td>
			<input  maxlength="20" id="g_hours_to_make" name="g_hours_to_make" type="text" 
			value="<?php if ($update || $view) echo $_SESSION[GARMENTS][$_REQUEST['selectedGarment']]['g_hours_to_make']; ?>"
			<?php if ($update || $view) echo 'readonly'; ?>  />			
		</td>
	</tr>

<tr>
		<td align="right">
			<label for="g_est_fabric_required">Estimated Fabric Required</label>			
		</td>
		<td>
			<input  maxlength="20" id="g_est_fabric_required" name="g_est_fabric_required" type="text" 
			value="<?php if ($update || $view) echo $_SESSION[GARMENTS][$_REQUEST['selectedGarment']]['g_est_fabric_required']; ?>"
			<?php if ($update || $view) echo 'readonly'; ?>  />			
		</td>
	</tr>		
				
</table>


	 	
<?php 
	if ($add) foot("ADD", "addGarmentLogic.php"); 
	else if ($update) foot("UPDATE", "updateGarmentLogic.php?selectedGarment=" .
	 $_SESSION[GARMENTS][$_REQUEST['selectedGarment']]['g_garment_id']); 
	else foot();
?>


